﻿@inject IHttpService _httpService



@inject NavigationManager NavigationManager
@inject IJSRuntime JS
@inject IDataCacheService _dataCatcheService



@if (string.IsNullOrWhiteSpace(Model.Name) == false)
{
    <CnGalWebSite.Shared.MasaComponent.Shared.Cards.TitleTip Title="@(Model.Name)" Description="@Model.BriefIntroduction" Image="@Model.MainPicture" />
}
else
{
    <CnGalWebSite.Shared.MasaComponent.Shared.Cards.TitleTip />
}

<div>
    @if (isReady == false)
    {
        <CnGalWebSite.Components.Progressings.ProgressingCard Page Outline />
    }
    else
    {
        <CnGalWebSite.Shared.MasaComponent.PC.Articles.MainInforCard Model="Model" HiddenImage HiddenTitle="HiddenTitle" Outline="Outline" HiddenCatalog />
    }
</div>


@code {
    [Parameter]
    public long Id { get; set; }
    [Parameter]
    public bool HiddenTitle { get; set; }
    [Parameter]
    public bool Outline { get; set; }

    bool isReady;
    public ArticleViewModel Model { get; set; } = new ArticleViewModel();

    protected override async Task OnInitializedAsync()
    {
        try
        {
            isReady = false;
            //获取文章信息
            Model = await _dataCatcheService.ArticleIndexPageCatche.GetCache(Id.ToString());

            isReady = true;
            StateHasChanged();

        }
        catch (Exception exc)
        {
            isReady = false;
            StateHasChanged();
        }

    }

}
